package pattern.factory.pizzaStore

import pattern.factory.ingredient.NYPizzaIngredientFactory
import pattern.factory.pizza.{ClamPizza, CheesePizza, Pizza}

/**
 * Created by root on 15-9-7.
 */
class NYPizzaStore extends PizzaStore{
  override protected def createPizza(pizzaType: String): Pizza = {
    var pizza:Pizza = null
    val ingredientFactory = new NYPizzaIngredientFactory
    if(pizzaType == "cheese"){
      pizza = new CheesePizza(ingredientFactory)
      pizza.setName("New York Style Cheese Pizza")
    }else if(pizzaType=="clam"){
      pizza = new ClamPizza(ingredientFactory)
      pizza.setName("New York Style Clam Pizza")
    }
    pizza
  }
}
